package kit.edu.lego.gruppe3.levels;

/**
 * Class for maintaining the global knowledge of the current level the robot is solving
 * @author elacic
 *
 */
public class LevelSelector {
	
	public enum Level{
		labyrinth,
		line,
		bridge,
		rotatitngBrigde,
		treeArea,
		sumpf,
		rollBridge,
		fallingBridge,
		endZone,
		firstDoor
	}
	
	
	private static LevelSelector instance = null;
	private volatile Level currentLevel = Level.labyrinth;
	
	
	private LevelSelector(){
		
	}
	
	public static synchronized LevelSelector getInstance(){
		if (instance != null) {
			return instance;
		} else {
			instance = new LevelSelector();
			return instance;
		}
	}

	public synchronized void setCurrentLevel(Level currentLevel) {
		this.currentLevel = currentLevel;
	}

	public synchronized Level getCurrentLevel() {
		return currentLevel;
	}
	
	public synchronized boolean isLabyrinth(){
		return currentLevel == Level.labyrinth;
	}
	
	public synchronized boolean isLine(){
		return currentLevel == Level.line;
	}
	
	public synchronized boolean isBridge(){
		return currentLevel == Level.bridge;
	}
	
	public synchronized boolean isTreeArea(){
		return currentLevel == Level.treeArea;
	}
	
	public synchronized boolean isRotatingBridge(){
		return currentLevel == Level.rotatitngBrigde;
	}
	
	public synchronized boolean isSumpf(){
		return currentLevel == Level.sumpf;
	}
	
	public synchronized boolean isRollBridge(){
		return currentLevel == Level.rollBridge;
	}
	
	public synchronized boolean isFallingBridge(){
		return currentLevel == Level.fallingBridge;
	}
	
	public synchronized boolean isEndZone(){
		return currentLevel == Level.endZone;
	}
	
	public synchronized boolean isDore(){
		return currentLevel == Level.firstDoor;
	}

}
